From: Dario Faggioli Date: Tue, 17 Mar 2015 09:56:48 +0000 (+0100) Subject: sched: make counters for vCPU sleep and wakeup generic X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3617 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8b0e94da0e23221a6d7ea19bfbd24a407db44de8;p=xen.git sched: make counters for vCPU sleep and wakeup generic and update them from Credit2 and RTDS. In Credit2, while there, remove some stale comments too. Signed-off-by: Dario Faggioli Reviewed-by: Meng Xu Acked-by: Jan Beulich Acked-by: George Dunlap --- diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index f0e2c82e71..7655ad4c4c 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) struct csched2_vcpu * const svc = CSCHED2_VCPU(vc); BUG_ON( is_idle_vcpu(vc) ); + SCHED_STAT_CRANK(vcpu_sleep); if ( curr_on_cpu(vc->processor) == vc ) cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ); @@ -956,19 +957,23 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) BUG_ON( is_idle_vcpu(vc) ); - /* Make sure svc priority mod happens before runq check */ if ( unlikely(curr_on_cpu(vc->processor) == vc) ) { + SCHED_STAT_CRANK(vcpu_wake_running); goto out; } if ( unlikely(__vcpu_on_runq(svc)) ) { - /* If we've boosted someone that's already on a runqueue, prioritize - * it and inform the cpu in question. */ + SCHED_STAT_CRANK(vcpu_wake_onrunq); goto out; } + if ( likely(vcpu_runnable(vc)) ) + SCHED_STAT_CRANK(vcpu_wake_runnable); + else + SCHED_STAT_CRANK(vcpu_wake_not_runnable); + /* If the context hasn't been saved for this vcpu yet, we can't put it on * another runqueue. Instead, we set a flag so that it will be put on the runqueue * after the context has been saved. */ diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 58dd646908..49d1b830c6 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -851,6 +851,7 @@ rt_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) struct rt_vcpu * const svc = rt_vcpu(vc); BUG_ON( is_idle_vcpu(vc) ); + SCHED_STAT_CRANK(vcpu_sleep); if ( curr_on_cpu(vc->processor) == vc ) cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ); @@ -966,11 +967,22 @@ rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) BUG_ON( is_idle_vcpu(vc) ); if ( unlikely(curr_on_cpu(vc->processor) == vc) ) + { + SCHED_STAT_CRANK(vcpu_wake_running); return; + } /* on RunQ/DepletedQ, just update info is ok */ if ( unlikely(__vcpu_on_q(svc)) ) + { + SCHED_STAT_CRANK(vcpu_wake_onrunq); return; + } + + if ( likely(vcpu_runnable(vc)) ) + SCHED_STAT_CRANK(vcpu_wake_runnable); + else + SCHED_STAT_CRANK(vcpu_wake_not_runnable); /* If context hasn't been saved for this vcpu yet, we can't put it on * the Runqueue/DepletedQ. Instead, we set a flag so that it will be diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h index 3ac7b45ac3..2dc78fe848 100644 --- a/xen/include/xen/perfc_defn.h +++ b/xen/include/xen/perfc_defn.h @@ -21,6 +21,11 @@ PERFCOUNTER(dom_init, "sched: dom_init") PERFCOUNTER(dom_destroy, "sched: dom_destroy") PERFCOUNTER(vcpu_init, "sched: vcpu_init") PERFCOUNTER(vcpu_destroy, "sched: vcpu_destroy") +PERFCOUNTER(vcpu_sleep, "sched: vcpu_sleep") +PERFCOUNTER(vcpu_wake_running, "sched: vcpu_wake_running") +PERFCOUNTER(vcpu_wake_onrunq, "sched: vcpu_wake_onrunq") +PERFCOUNTER(vcpu_wake_runnable, "sched: vcpu_wake_runnable") +PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable") /* credit specific counters */ PERFCOUNTER(delay_ms, "csched: delay") @@ -32,11 +37,6 @@ PERFCOUNTER(acct_reorder, "csched: acct_reorder") PERFCOUNTER(acct_min_credit, "csched: acct_min_credit") PERFCOUNTER(acct_vcpu_active, "csched: acct_vcpu_active") PERFCOUNTER(acct_vcpu_idle, "csched: acct_vcpu_idle") -PERFCOUNTER(vcpu_sleep, "csched: vcpu_sleep") -PERFCOUNTER(vcpu_wake_running, "csched: vcpu_wake_running") -PERFCOUNTER(vcpu_wake_onrunq, "csched: vcpu_wake_onrunq") -PERFCOUNTER(vcpu_wake_runnable, "csched: vcpu_wake_runnable") -PERFCOUNTER(vcpu_wake_not_runnable, "csched: vcpu_wake_not_runnable") PERFCOUNTER(vcpu_park, "csched: vcpu_park") PERFCOUNTER(vcpu_unpark, "csched: vcpu_unpark") PERFCOUNTER(tickle_idlers_none, "csched: tickle_idlers_none")